﻿<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="StockOutEdit.aspx.cs" Inherits="StockOutEdit" Title="StockOut Edit" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    Stock Out - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <data:MultiFormView ID="FormView1" DataKeyNames="StockOutId" runat="server" DataSourceID="StockOutDataSource">
        <EditItemTemplatePaths>
            <data:TemplatePath Path="~/Admin/UserControls/StockOutFields.ascx" />
        </EditItemTemplatePaths>
        <InsertItemTemplatePaths>
            <data:TemplatePath Path="~/Admin/UserControls/StockOutFields.ascx" />
        </InsertItemTemplatePaths>
        <EmptyDataTemplate>
            <b>StockOut not found!</b>
        </EmptyDataTemplate>
        <FooterTemplate>
            <asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                Text="Insert" />
            <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                Text="Update" />
            <asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="Cancel" />
        </FooterTemplate>
    </data:MultiFormView>
    <data:StockOutDataSource ID="StockOutDataSource" runat="server" SelectMethod="GetByStockOutId">
        <Parameters>
            <asp:QueryStringParameter Name="StockOutId" QueryStringField="StockOutId" Type="String" />
        </Parameters>
    </data:StockOutDataSource>
    <br />
    <data:EntityGridView ID="GridViewStockOutDetails1" runat="server" AutoGenerateColumns="False"
        OnSelectedIndexChanged="GridViewStockOutDetails1_SelectedIndexChanged" DataSourceID="StockOutDetailsDataSource1"
        DataKeyNames="StockOutDetailId" AllowMultiColumnSorting="false" DefaultSortColumnName=""
        DefaultSortDirection="Ascending" ExcelExportFileName="Export_StockOutDetails.xls"
        Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'>
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <data:HyperLinkField HeaderText="Stock Out Id" DataNavigateUrlFormatString="StockOutEdit.aspx?StockOutId={0}"
                DataNavigateUrlFields="StockOutId" DataContainer="StockOutIdSource" DataTextField="StockOutId" />
            <asp:BoundField DataField="DrugId" HeaderText="Drug Id" SortExpression="[DrugId]" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="[Quantity]" />
            <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" SortExpression="[UnitPrice]" />
            <asp:BoundField DataField="ExpDate" HeaderText="Exp Date" SortExpression="[ExpDate]" />
            <asp:BoundField DataField="BatchLot" HeaderText="Batch Lot" SortExpression="[BatchLot]" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Stock Out Details Found! </b>
            <asp:HyperLink runat="server" ID="hypStockOutDetails" NavigateUrl="~/admin/StockOutDetailsEdit.aspx">Add New</asp:HyperLink>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <data:StockOutDetailsDataSource ID="StockOutDetailsDataSource1" runat="server" SelectMethod="Find"
        EnableDeepLoad="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:StockOutDetailsProperty Name="StockOut" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:SqlParameter Name="Parameters">
                <Filters>
                    <data:StockOutDetailsFilter Column="StockOutId" QueryStringField="StockOutId" />
                </Filters>
            </data:SqlParameter>
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
        </Parameters>
    </data:StockOutDetailsDataSource>
    <br />
</asp:Content>
